//
//  BangkaVC.m
//  SSC
//
//  Created by 红沙尘 on 17/6/10.
//  Copyright © 2017年 红沙尘. All rights reserved.
//

#import "BangkaVC.h"

@interface BangkaVC ()
{
    __weak IBOutlet UIButton *sureBtn;
    
    __weak IBOutlet UITextField *fieldA;
    __weak IBOutlet UITextField *fieldB;
    __weak IBOutlet UITextField *fieldC;
    __weak IBOutlet UITextField *fieldD;
    
    __weak IBOutlet NSLayoutConstraint *lineA;
    __weak IBOutlet NSLayoutConstraint *lineB;
    __weak IBOutlet NSLayoutConstraint *lineC;
    __weak IBOutlet NSLayoutConstraint *lineD;
    
}

@end

@implementation BangkaVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setTitle:@"绑定银行卡"];
    
    lineA.constant = LineHeight;
    lineB.constant = LineHeight;
    lineC.constant = LineHeight;
    lineD.constant = LineHeight;
    
    sureBtn.layer.cornerRadius = 2;
    sureBtn.layer.masksToBounds = YES;
}

- (IBAction)chongzhi {
    
    if (fieldA.text.length == 0) {
        [MTool showMessage:@"请输入银行名称" inView:nil];
        return;
    }
    
    if (fieldB.text.length == 0) {
        [MTool showMessage:@"请输入开户行名称" inView:nil];
        return;
    }
    
    if (fieldC.text.length == 0) {
        [MTool showMessage:@"请输入银行卡号" inView:nil];
        return;
    }
    
    if (fieldD.text.length == 0) {
        [MTool showMessage:@"请输入银行卡账户名" inView:nil];
        return;
    }
    
    [LoadingView show];
    
    [SSCRequest bindCardWithBanks:fieldA.text
                         bankname:fieldB.text
                         bankcard:fieldC.text
                         username:fieldD.text
                          success:^(NSDictionary *responseObject)
     {
         [LoadingView diss];
         [MTool showMessage:responseObject[@"msg"] inView:nil];
    } fail:^(NSError *error) {
        [LoadingView diss];
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
